# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  helper :all # include all helpers, all the time
  include AuthenticatedSystem
  
  # See ActionController::RequestForgeryProtection for details
  # Uncomment the :secret if you're not using the cookie session store
  protect_from_forgery # :secret => '35c997fb4e9468d0d4350e2030b56b95'
  
  # See ActionController::Base for details 
  # Uncomment this to filter the contents of submitted sensitive data parameters
  # from your application log (in this case, all fields with names like "password"). 
  filter_parameter_logging :password
   
protected
  # TODO(matias): remove this when no longer needed
  def authenticate_via_http
    authenticate_or_request_with_http_basic do |username, password|
      Digest::SHA1.hexdigest(username) == ADMIN_USERNAME and 
          Digest::SHA1.hexdigest(password) == ADMIN_PASSWORD
    end
  end
end
